﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DomainDriver.DomainModeling.Constraints;
using DomainDriver.DomainModeling.DataProviders;
using DomainDriver.DomainModeling.DomainObjects;
using DomainDriver.DomainModeling.Repositories;
using DomainDriver.DomainModeling.TransactionScripts;

namespace DomainDriver.DomainModeling.DomainModels
{
    public interface IDomainModel
    {
        //public event EventHandler CreateConstraints;

        DataSourcePersistenceType PersistenceType { get; }
        IDataProvider DataProvider { get; }
        IDictionary<DataSourcePersistenceType, Type> DataSourceTypesForPersistenceTypes { get; }
        IList<IConstraint> Constraints { get; }

        //void RegisterDataSource<DATASOURCE>(DataSourcePersistenceType persistenceType)
        //    where DATASOURCE : new();
        //void RegisterDomainObject<KEY, KEYED_DOMAIN_OBJECT>()
        //    where KEYED_DOMAIN_OBJECT : IKeyedDomainObject<KEY, KEYED_DOMAIN_OBJECT>;
        //void RegisterConstraint<CONSTRAINT>()
        //    where CONSTRAINT : class, IConstraint;
        //void Initialize();

        //DATASOURCE CreateDataSource<DATASOURCE>(DataSourcePersistenceType persistenceType);
        object CreateDataSource(DataSourcePersistenceType persistenceType);
        DATA_PROVIDER GetDataProvider<DATA_PROVIDER>()
            where DATA_PROVIDER : IDataProvider;
        IDataProvider GetDataProvider();
        bool HasConstraint<CONSTRAINT>()
            where CONSTRAINT : IConstraint;
        CONSTRAINT GetConstraint<CONSTRAINT>()
            where CONSTRAINT : IConstraint;
        bool HasRepository<KEY, KEYED_DOMAIN_OBJECT>()
            where KEYED_DOMAIN_OBJECT : IKeyedDomainObject<KEY, KEYED_DOMAIN_OBJECT>;
        IRepository<KEY, KEYED_DOMAIN_OBJECT> GetRepository<KEY, KEYED_DOMAIN_OBJECT>()
            where KEYED_DOMAIN_OBJECT : IKeyedDomainObject<KEY, KEYED_DOMAIN_OBJECT>;
        TRANSACTION_SCRIPT CreateTransactionScript<TRANSACTION_SCRIPT>()
            where TRANSACTION_SCRIPT : ITransactionScript, new();
    }
}